package cn.project.lemontree.utils;

import org.apache.shiro.authc.AuthenticationToken;

public class MyAuthenticationToken implements AuthenticationToken {

    private String telephone;
    private char[] password;
    private int role;   //role = 1 教师;role = 0 家长;role = 2 管理员

    public void setRole(int role){
        this.role = role;
    }

    public int getRole(){
        return role;
    }

    public void setTelephone(String telephone){
        this.telephone = telephone;
    }

    public void setPassword(char[] password){
        this.password = password;
    }

    public String getTelephone(){
        return telephone;
    }

    public char[] getPassword(){
        return password;
    }

    @Override
    public Object getPrincipal() {
        return getTelephone();
    }

    @Override
    public Object getCredentials() {
        return getPassword();
    }

    public MyAuthenticationToken(){}
    public MyAuthenticationToken(final String telephone,final char[] password,final int role){
        this.telephone = telephone;
        this.password = password;
        this.role = role;
    }

}